package com.hry.store.service.impl;

import com.hry.store.dao.SecondCategoryMapper;
import com.hry.store.pojo.SecondCategory;
import com.hry.store.service.SecondCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SecondCategoryServiceImpl implements SecondCategoryService {
    @Autowired
    private SecondCategoryMapper secondCategoryMapper;

    /**
     * 根据一级分类Id查询二级分类
     * @param topCategoryId
     * @return
     */
    @Override
    public List<SecondCategory> selectByTopCategoryId(Integer topCategoryId) {
        return secondCategoryMapper.selectByTopCategoryId(topCategoryId);
    }

    /**
     * 查询商品信息
     * @param secondCategoryId
     * @return
     */
    @Override
    public SecondCategory getProductBySecondCategoryId(Integer secondCategoryId) {
        return secondCategoryMapper.selectByPrimaryKey(secondCategoryId);
    }
}
